/**
 * Created by Kylin on 2016/12/6.
 */
import React, {Component} from 'react';

import Prism from '../../../build/bower_components/prism/prism';
import '../../../build/bower_components/prism/prism.css';

export default class HighLight extends Component {
    componentDidMount() {
        this.highlightCode();
    }

    componentDidUpdate() {
        this.highlightCode();
    }

    highlightCode() {
        Prism.highlightElement(this.refs.code, this.props.async);
    }

    render() {
        return (<pre className="highlight"><code ref="code" className={this.props.className}>{this.props.children}</code></pre>)
    }
}

